package com.hkts.naturalgasauthentication.base.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.hkts.naturalgasauthentication.common.constant.CommonConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;


import javax.persistence.*;
import java.util.List;

@Entity
@Table(name = "user")
@Data
@ApiModel(description= "用户表")
public class User extends ManagementBaseEntity{
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("用户名")
    @Column(name = "user_name")
    private String userName;

    @ApiModelProperty("密码")
    @Column(name = "pass_word")
    private String passWord;

    @ApiModelProperty("用户状态")
    @Column(name = "status")//状态 默认0正常 -1拉黑
    private Integer status = CommonConstant.USER_STATUS_NORMAL;

    @ApiModelProperty("姓名")
    @Column(name = "nick_name")
    private String nickName;

    @ApiModelProperty("手机号")
    @Column(name = "mobile")
    private String mobile;

    @ApiModelProperty("邮箱")
    @Column(name = "email")
    private String email;

    @ApiModelProperty("地址")
    @Column(name = "address")
    private String address;

    @ApiModelProperty("街道")
    @Column(name = "street")
    private String street;

    @ApiModelProperty("性别")
    @Column(name = "sex")
    private String sex;

    @ApiModelProperty("密码强度")
    @Column(length = 2)
    private String passStrength;

    //@Column(length = 1000)
    //private String avatar = CommonConstant.USER_DEFAULT_AVATAR;

    //@Basic(fetch= FetchType.LAZY)
    @ApiModelProperty("头像")
    private String avatar;
    @ApiModelProperty("用户类别，0是货主，1是管理员")
    private Integer type = CommonConstant.USER_TYPE_NORMAL;

    @ApiModelProperty("级别")
    @Column(name = "user_level")
    private Integer userLevel;

    @ApiModelProperty("描述")
    @Column(name = "description")
    private String description;


    @ApiModelProperty("open_id")
    @Column(name = "open_id")
    private String openId;

    @ApiModelProperty("部门id")
    @Column(name = "department_id")
    private String departmentId;

    @ApiModelProperty("公司id ,取company表 company_code字段")
    @Column(name = "company_id")
    private String companyId;

    @Transient
    @TableField(exist=false)
    @ApiModelProperty("角色")
    private List<Role> roles;

    @Transient
    @TableField(exist=false)
    @ApiModelProperty("公司名称")
    private String companyName;

    @Transient
    @TableField(exist=false)
    private String departmentTitle;

    @Transient
    @TableField(exist=false)
    @ApiModelProperty("权限")
    private List<Permission> permissions;

    /**
     *联系电话
     */
    @Transient
    @TableField(exist=false)
    @ApiModelProperty("联系电话")
    private List<String> contactNumber;
}
